from time import sleep
from selenium import webdriver
# 1.打开浏览器
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path='chromedriver.exe')
# driver = webdriver.Chrome() #创建浏览器对象
# 2.输入访问地址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")
driver.maximize_window()
# 输入用户：admin1，暂停2秒，删除1
username =driver.find_element_by_css_selector("#userA")
username.send_keys("admin1")
# 暂停2秒
sleep(2)
username.send_keys(Keys.BACK_SPACE)
# 全选用户名：admin，暂停2秒
username.send_keys(Keys.CONTROL, 'a')
sleep(2)

# 复制户名：admin，暂停2秒
username.send_keys(Keys.CONTROL, 'c')
# 暂停2秒
sleep(2)

# 粘贴到密码框
# 定位到密码框，执行ctrl+v
password = driver.find_element_by_css_selector("#passwordA")
password.send_keys(Keys.CONTROL, 'v')